package {{pack}}.logbook;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.zalando.logbook.DefaultHttpLogWriter.Level;

@ConfigurationProperties(prefix = "spring.httplog")
public final class SimpleLogbookProperties {

    private final List<String> exclude = new ArrayList<>();
    private final Obfuscate obfuscate = new Obfuscate();
    private final Write write = new Write();

    private static final Integer DEFAULT_CUT_OFF_ENGTH = 2000;

    private Integer bodyCutOffLength = DEFAULT_CUT_OFF_ENGTH;

    public List<String> getExclude() {
        return exclude;
    }

    public Obfuscate getObfuscate() {
        return obfuscate;
    }

    public Write getWrite() {
        return write;
    }

    public static class Obfuscate {

        private final List<String> headers = new ArrayList<>();
        private final List<String> parameters = new ArrayList<>();

        public List<String> getHeaders() {
            return headers;
        }

        public List<String> getParameters() {
            return parameters;
        }

    }

    public static class Write {

        private String category = "spring-httplog";
        private Level level = Level.DEBUG;
        private int chunkSize = 0;

        public String getCategory() {
            return category;
        }

        public void setCategory(final String category) {
            this.category = category;
        }

        public Level getLevel() {
            return level;
        }

        public void setLevel(final Level level) {
            this.level = level;
        }

        public int getChunkSize() {
            return chunkSize;
        }

        public void setChunkSize(final int chunkSize) {
            this.chunkSize = chunkSize;
        }

    }

    public Integer getBodyCutOffLength() {
      return bodyCutOffLength;
    }

    public void setBodyCutOffLength(Integer bodyCutOffLength) {
      this.bodyCutOffLength = bodyCutOffLength;
    }

}
